package com.meida.module.bus.provider.handler;

import com.meida.common.mybatis.entity.EntityMap;
import com.meida.common.mybatis.interceptor.ExportInterceptor;
import com.meida.common.mybatis.model.ResultBody;
import com.meida.common.utils.FlymeUtils;
import com.meida.module.bus.client.entity.BusReportOutone;
import com.meida.module.bus.provider.service.BusReportOutoneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Component("busReportOutOneExportHandler")
public class BusReportOutOneExportHandler implements ExportInterceptor<BusReportOutone> {

    @Autowired
    BusReportOutoneService busReportOutoneService;


    @Override
    public ResultBody initData(Map params) {
        List<EntityMap> busReportOutOneList = busReportOutoneService.getExportData(params);
        ResultBody resultBody = new ResultBody();
        List<EntityMap> list = new ArrayList();
        if (FlymeUtils.isEmpty(busReportOutOneList)) {
            list.add(new EntityMap());
            resultBody.data(list);
        } else {
            resultBody.data(busReportOutOneList);
        }
        return resultBody;
    }
}

